var express=require('express');
var label=require('../models/label');
var article=require('../models/article');
var router=express.Router();

router.get('/:id',function(req,res,next){
    var id=req.params["id"];
    label.get(id,function(err,data){
        if(err){
            throw new Error(err); 
        }

        article.listByIds(data.articleIds,function(err,articleList){
            if(err){
                throw new Error(err);
            }

            res.render('label',{
                articles:articleList
            });
        });
        
    });
});